package Java实验.实验四;
public class Demo3 {
    public static void main(String[] args) {
        /********** Begin *********/
        Animal cat = new Cat();
        Animal dog = new Dog();
        /********** End *********/
        cat.eat();
        cat.work();
        dog.eat();
        dog.work();
    }
}

abstract class Animal {
    abstract void eat();
    abstract void work();
}

/********** Begin *********/
class Cat extends Animal {
    void eat(){
        System.out.println("吃鱼");
    }
    void work(){
        System.out.println("抓老鼠");
    }
}

class Dog extends Animal {
    void eat(){
        System.out.println("吃骨头");
    }
    void work(){
        System.out.println("看家");
    }
}
/********** End *********/
